#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const ll N = 2e5 + 10;
// ll a[N];
void solve()
{
    ll n;
    cin >> n;
    ll a = (n - 1) / 500;
    char c = 'A' + a;
    ll b = n % 500;
    if (n >= 500)
    {
        ll b1 = n % 500;
        if (b1 == 0)
        {
            b1 = 500;
        }
        b = b1;
    }

    cout << c;
    string s = to_string(b);
    if (s.size() == 1)
    {
        s = "00" + s;
    }
    else if (s.size() == 2)
    {
        s = "0" + s;
    }
    cout << s << endl;
}
int main()
{
    ll t = 1;
    // cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}